﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations.FwProjectAppShopDb
{
    public partial class init : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Brand",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    BrandName = table.Column<string>(maxLength: 200, nullable: false),
                    Levetype = table.Column<int>(nullable: false),
                    NoteContent = table.Column<string>(maxLength: 500, nullable: true),
                    Piclogo = table.Column<string>(nullable: true),
                    Orders = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Brand", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "commodity_collection",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    UserId = table.Column<long>(nullable: false),
                    ShopproductId = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_commodity_collection", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductSpcevalue",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Spcevalue = table.Column<string>(maxLength: 200, nullable: false),
                    ProductSpceid = table.Column<Guid>(nullable: false),
                    Spcevalueico = table.Column<string>(nullable: true),
                    Orders = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductSpcevalue", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductType",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TypeName = table.Column<string>(maxLength: 200, nullable: false),
                    Isflagattr = table.Column<bool>(nullable: false),
                    Ispro = table.Column<bool>(nullable: false),
                    Isbrand = table.Column<bool>(nullable: false),
                    IsSpec = table.Column<bool>(nullable: false),
                    Orders = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductType_Attr",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    AttrName = table.Column<string>(maxLength: 200, nullable: false),
                    ProductTypeid = table.Column<Guid>(nullable: false),
                    Attrvalue = table.Column<string>(nullable: false),
                    Unit = table.Column<string>(maxLength: 200, nullable: false),
                    Issearch = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductType_Attr", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductType_Brand",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ProductTypebrandid = table.Column<Guid>(nullable: false),
                    ProductTypeid = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductType_Brand", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductType_Par",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    GroupName = table.Column<string>(maxLength: 200, nullable: false),
                    ProductTypeid = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductType_Par", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductType_Parvalue",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ProductTypeparid = table.Column<Guid>(nullable: false),
                    Parvalue = table.Column<string>(maxLength: 200, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductType_Parvalue", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductTypeSpce",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SpceName = table.Column<string>(maxLength: 200, nullable: false),
                    SpceType = table.Column<int>(nullable: false),
                    ProductTypeid = table.Column<Guid>(nullable: true),
                    Orders = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductTypeSpce", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_Ad_location",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    AdLocationTitle = table.Column<string>(maxLength: 200, nullable: false),
                    AdHeight = table.Column<int>(nullable: false),
                    AdWidht = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_Ad_location", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_car",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    ShopproductId = table.Column<Guid>(nullable: false),
                    ProductCount = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_car", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_coupon",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    CouponType = table.Column<byte>(nullable: false),
                    UseCoupon = table.Column<byte>(nullable: false),
                    CouponPrice = table.Column<decimal>(nullable: false),
                    UsePrice = table.Column<decimal>(nullable: false),
                    CouponPic = table.Column<string>(nullable: false),
                    CouponNotPic = table.Column<string>(nullable: true),
                    UseBeginTime = table.Column<DateTime>(nullable: false),
                    UseEndTime = table.Column<DateTime>(nullable: false),
                    CouponCount = table.Column<int>(nullable: false),
                    CouponTitile = table.Column<string>(nullable: false),
                    CouponDescribe = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_coupon", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_order",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    OrderNumber = table.Column<string>(nullable: true),
                    PayStatus = table.Column<byte>(nullable: false),
                    PayType = table.Column<byte>(nullable: false),
                    PayTotal = table.Column<decimal>(nullable: false),
                    PyaPreferentia = table.Column<decimal>(nullable: false),
                    PayAmount = table.Column<decimal>(nullable: false),
                    ReceivingAddress = table.Column<string>(maxLength: 200, nullable: false),
                    PayTime = table.Column<DateTime>(nullable: true),
                    OrderLeavingMessage = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_order", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_receiving_address",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    ReceivingName = table.Column<string>(maxLength: 50, nullable: false),
                    ReceivingTel = table.Column<string>(maxLength: 13, nullable: false),
                    ReceivingAddress = table.Column<string>(maxLength: 200, nullable: false),
                    AreaId = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_receiving_address", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_secondkill",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ShopProductId = table.Column<Guid>(nullable: false),
                    SecondkillPrice = table.Column<decimal>(nullable: false),
                    SecondkillCount = table.Column<int>(nullable: false),
                    SecondkillSingleCount = table.Column<int>(nullable: false),
                    SecondkillBeginTime = table.Column<DateTime>(nullable: false),
                    SecondkillEndTime = table.Column<DateTime>(nullable: false),
                    SecondkillTitle = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_secondkill", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_supplier",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SupplierName = table.Column<string>(maxLength: 50, nullable: false),
                    SupplierTel = table.Column<string>(maxLength: 13, nullable: false),
                    SupplierAddress = table.Column<string>(maxLength: 200, nullable: false),
                    IsActive = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_supplier", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProduct",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ShopTypeid = table.Column<Guid>(nullable: false),
                    ProductName = table.Column<string>(maxLength: 200, nullable: false),
                    ProductNumber = table.Column<string>(maxLength: 200, nullable: false),
                    MarketPrice = table.Column<decimal>(nullable: false),
                    ProductDetails = table.Column<string>(maxLength: 500, nullable: false),
                    SpcemarketPrice = table.Column<decimal>(nullable: false),
                    SpcecostPrice = table.Column<decimal>(nullable: false),
                    SpceWeight = table.Column<float>(nullable: false),
                    SpceIsActive = table.Column<bool>(nullable: false),
                    Brandid = table.Column<Guid>(nullable: true),
                    Unit = table.Column<string>(maxLength: 200, nullable: true),
                    IsGrounding = table.Column<bool>(nullable: false),
                    ShopSupplierid = table.Column<Guid>(nullable: false),
                    ShopProductFlag = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProduct", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProductAttr",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ShopProductid = table.Column<Guid>(nullable: false),
                    AttrKey = table.Column<string>(maxLength: 200, nullable: false),
                    AttrValue = table.Column<string>(maxLength: 200, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProductAttr", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProductPar",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ParKey = table.Column<string>(maxLength: 200, nullable: false),
                    ParValue = table.Column<string>(maxLength: 200, nullable: false),
                    ShopProductid = table.Column<Guid>(nullable: false),
                    SpceWeight = table.Column<float>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProductPar", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProductPic",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    PicUrl = table.Column<string>(nullable: false),
                    ShopProductid = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProductPic", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProductSku",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SpaceValueid = table.Column<string>(nullable: false),
                    ShopProductid = table.Column<Guid>(nullable: false),
                    SpceMarketPrice = table.Column<decimal>(nullable: false),
                    SpceCostPrice = table.Column<decimal>(nullable: false),
                    SpceWeight = table.Column<float>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProductSku", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProductSpce",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Spaceid = table.Column<Guid>(nullable: false),
                    ShopProductid = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProductSpce", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProductSpceValue",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Spaceid = table.Column<Guid>(nullable: false),
                    SpaceValueid = table.Column<Guid>(nullable: false),
                    ShopProductid = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProductSpceValue", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopProductTag",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Tagid = table.Column<Guid>(nullable: false),
                    ShopProductid = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopProductTag", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopTag",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TagName = table.Column<string>(maxLength: 200, nullable: false),
                    TagType = table.Column<int>(nullable: false),
                    IsActive = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopTag", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShopType",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Parentid = table.Column<Guid>(nullable: false),
                    TypeName = table.Column<string>(maxLength: 200, nullable: false),
                    ProductTypeid = table.Column<Guid>(nullable: false),
                    Isactive = table.Column<bool>(nullable: false),
                    Piclogo = table.Column<string>(nullable: true),
                    Orders = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "shop_Ad",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    AdName = table.Column<string>(maxLength: 50, nullable: false),
                    PicLogo = table.Column<string>(nullable: false),
                    HttpUrl = table.Column<string>(nullable: false),
                    IsActive = table.Column<bool>(nullable: false),
                    ContentDetails = table.Column<string>(nullable: true),
                    AdType = table.Column<byte>(nullable: false),
                    JsonSource = table.Column<string>(nullable: true),
                    AdbeginTime = table.Column<DateTime>(nullable: false),
                    AdEndTime = table.Column<DateTime>(nullable: false),
                    Charge = table.Column<decimal>(nullable: false),
                    AdFlag = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_Ad", x => x.Id);
                    table.ForeignKey(
                        name: "FK_shop_Ad_shop_Ad_location_AdFlag",
                        column: x => x.AdFlag,
                        principalTable: "shop_Ad_location",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "shop_user_coupon",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    ShopCouponId = table.Column<Guid>(nullable: false),
                    UseStatus = table.Column<int>(nullable: false),
                    OrderNumber = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_user_coupon", x => x.Id);
                    table.ForeignKey(
                        name: "FK_shop_user_coupon_shop_coupon_ShopCouponId",
                        column: x => x.ShopCouponId,
                        principalTable: "shop_coupon",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "settlement_supplier",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SupplierId = table.Column<Guid>(nullable: false),
                    OrderNumber = table.Column<string>(nullable: false),
                    OrderId = table.Column<Guid>(nullable: false),
                    SettlementTime = table.Column<DateTime>(nullable: false),
                    SettlementPrice = table.Column<decimal>(nullable: false),
                    SettlementPreferentia = table.Column<decimal>(nullable: false),
                    SettlementAmount = table.Column<decimal>(nullable: false),
                    SettlementId = table.Column<long>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_settlement_supplier", x => x.Id);
                    table.ForeignKey(
                        name: "FK_settlement_supplier_shop_order_OrderId",
                        column: x => x.OrderId,
                        principalTable: "shop_order",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "shop_order_coupon",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    OrderNumber = table.Column<string>(nullable: true),
                    OrderId = table.Column<Guid>(nullable: false),
                    UserId = table.Column<long>(nullable: false),
                    ShopCouponId = table.Column<Guid>(nullable: false),
                    ShopUserCouponId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_order_coupon", x => x.Id);
                    table.ForeignKey(
                        name: "FK_shop_order_coupon_shop_order_OrderId",
                        column: x => x.OrderId,
                        principalTable: "shop_order",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_shop_order_coupon_shop_coupon_ShopCouponId",
                        column: x => x.ShopCouponId,
                        principalTable: "shop_coupon",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "shop_order_details",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    OrderNumber = table.Column<string>(nullable: false),
                    OrderId = table.Column<Guid>(nullable: true),
                    ProductCount = table.Column<int>(nullable: false),
                    ShopproductId = table.Column<Guid>(nullable: false),
                    PayPrice = table.Column<decimal>(nullable: false),
                    ShopSkuId = table.Column<Guid>(nullable: false),
                    DeliveryTime = table.Column<DateTime>(nullable: false),
                    DeliveryStatus = table.Column<byte>(nullable: false),
                    SettlementTime = table.Column<DateTime>(nullable: true),
                    SettlementStatus = table.Column<byte>(nullable: false),
                    PriceDifference = table.Column<decimal>(nullable: false),
                    SettlementId = table.Column<Guid>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_shop_order_details", x => x.Id);
                    table.ForeignKey(
                        name: "FK_shop_order_details_shop_order_OrderId",
                        column: x => x.OrderId,
                        principalTable: "shop_order",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_shop_order_details_settlement_supplier_SettlementId",
                        column: x => x.SettlementId,
                        principalTable: "settlement_supplier",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_settlement_supplier_OrderId",
                table: "settlement_supplier",
                column: "OrderId");

            migrationBuilder.CreateIndex(
                name: "IX_shop_Ad_AdFlag",
                table: "shop_Ad",
                column: "AdFlag");

            migrationBuilder.CreateIndex(
                name: "IX_shop_order_coupon_OrderId",
                table: "shop_order_coupon",
                column: "OrderId");

            migrationBuilder.CreateIndex(
                name: "IX_shop_order_coupon_ShopCouponId",
                table: "shop_order_coupon",
                column: "ShopCouponId");

            migrationBuilder.CreateIndex(
                name: "IX_shop_order_details_OrderId",
                table: "shop_order_details",
                column: "OrderId");

            migrationBuilder.CreateIndex(
                name: "IX_shop_order_details_SettlementId",
                table: "shop_order_details",
                column: "SettlementId");

            migrationBuilder.CreateIndex(
                name: "IX_shop_user_coupon_ShopCouponId",
                table: "shop_user_coupon",
                column: "ShopCouponId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Brand");

            migrationBuilder.DropTable(
                name: "commodity_collection");

            migrationBuilder.DropTable(
                name: "ProductSpcevalue");

            migrationBuilder.DropTable(
                name: "ProductType");

            migrationBuilder.DropTable(
                name: "ProductType_Attr");

            migrationBuilder.DropTable(
                name: "ProductType_Brand");

            migrationBuilder.DropTable(
                name: "ProductType_Par");

            migrationBuilder.DropTable(
                name: "ProductType_Parvalue");

            migrationBuilder.DropTable(
                name: "ProductTypeSpce");

            migrationBuilder.DropTable(
                name: "shop_Ad");

            migrationBuilder.DropTable(
                name: "shop_car");

            migrationBuilder.DropTable(
                name: "shop_order_coupon");

            migrationBuilder.DropTable(
                name: "shop_order_details");

            migrationBuilder.DropTable(
                name: "shop_receiving_address");

            migrationBuilder.DropTable(
                name: "shop_secondkill");

            migrationBuilder.DropTable(
                name: "shop_supplier");

            migrationBuilder.DropTable(
                name: "shop_user_coupon");

            migrationBuilder.DropTable(
                name: "ShopProduct");

            migrationBuilder.DropTable(
                name: "ShopProductAttr");

            migrationBuilder.DropTable(
                name: "ShopProductPar");

            migrationBuilder.DropTable(
                name: "ShopProductPic");

            migrationBuilder.DropTable(
                name: "ShopProductSku");

            migrationBuilder.DropTable(
                name: "ShopProductSpce");

            migrationBuilder.DropTable(
                name: "ShopProductSpceValue");

            migrationBuilder.DropTable(
                name: "ShopProductTag");

            migrationBuilder.DropTable(
                name: "ShopTag");

            migrationBuilder.DropTable(
                name: "ShopType");

            migrationBuilder.DropTable(
                name: "shop_Ad_location");

            migrationBuilder.DropTable(
                name: "settlement_supplier");

            migrationBuilder.DropTable(
                name: "shop_coupon");

            migrationBuilder.DropTable(
                name: "shop_order");
        }
    }
}
